<?php 
$tpl=new TemplatePower("skin/sk_myadmin.htm");
$tpl->prepare();

if($_GET['code']=='02' && $_POST['gone']==1){
	$sql="SELECT * FROM users WHERE id_users='".$my['id']."' AND password='".md5(compile_post('currentpassword'))."'";
	$db=$DB->query($sql);
	if($rs=mysql_fetch_array($db) || compile_post('newpassword')!=''){
		if(compile_post('newpassword')==compile_post('confirmpassword')){
			$a=array();
			$a['name']		=compile_post('name');
			$a['email']		=compile_post('email');
			$a['telephone']	=compile_post('telephone');
			$a['active']	=compile_post('active');
			$a['password']	=md5(compile_post('newpassword'));
			$b=$DB->compile_db_update_string($a);
			$sql="UPDATE users SET ".$b." WHERE id_users=".$my['id'];
			$DB->query($sql);
			message("&#272;&#227; s&#7917;a ch&#7919;a th&#224;nh c&#244;ng !");
		}else {
			message("Password m&#7899;i v&#224; password nh&#7853;p l&#7841;i kh&#244;ng tr&#249;ng nhau ! ");
		}
		
	}else {
		message("Password c&#361; kh&#244;ng &#273;&#250;ng !");
	}
	
}
showlist();
function showlist(){
	global $my,$DB,$tpl;
	$sql="SELECT * FROM users WHERE id_users=".$my['id'];
	$db=$DB->query($sql);
	if($rs=mysql_fetch_array($db)){
		$tpl->assignGlobal("name",$rs['name']);
		$tpl->assignGlobal("username",$rs['username']);
		$tpl->assignGlobal("telephone",$rs['telephone']);
		$tpl->assignGlobal("email",$rs['email']);
	}
}
$tpl->printToScreen();
?>